/*  1:   */ package org.jetbrains.lang.manifest.completion;
/*  2:   */ 
/*  3:   */

import com.intellij.codeInsight.completion.*;
import com.intellij.codeInsight.lookup.LookupElement;
import com.intellij.codeInsight.lookup.LookupElementBuilder;
import com.intellij.openapi.editor.EditorModificationUtil;
import com.intellij.patterns.PlatformPatterns;
import com.intellij.util.ProcessingContext;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.lang.manifest.ManifestLanguage;
import org.jetbrains.lang.manifest.header.HeaderParserRepository;
import org.jetbrains.lang.manifest.psi.ManifestTokenType;

/*  4:   */
/*  5:   */
/*  6:   */
/*  7:   */
/*  8:   */
/*  9:   */
/* 10:   */
/* 11:   */
/* 12:   */
/* 13:   */
/* 14:   */
/* 15:   */
/* 16:   */
/* 17:   */
/* 18:   */
/* 19:   */
/* 20:   */ 
/* 21:   */ public class ManifestCompletionContributor
/* 22:   */   extends CompletionContributor
/* 23:   */ {
/* 24:   */   public ManifestCompletionContributor(@NotNull final HeaderParserRepository paramHeaderParserRepository)
/* 25:   */   {
/* 26:46 */     extend(CompletionType.BASIC, PlatformPatterns.psiElement(ManifestTokenType.HEADER_NAME).withLanguage(ManifestLanguage.INSTANCE), new CompletionProvider()
/* 27:   */     {
/* 28:   */       public void addCompletions(@NotNull CompletionParameters paramAnonymousCompletionParameters, ProcessingContext paramAnonymousProcessingContext, @NotNull CompletionResultSet paramAnonymousCompletionResultSet)
/* 29:   */       {
/* 30:53 */         if (paramAnonymousCompletionParameters == null) {
/* 31:53 */           throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/lang/manifest/completion/ManifestCompletionContributor$1", "addCompletions" }));
/* 32:   */         }
/* 33:53 */         if (paramAnonymousCompletionResultSet == null) {
/* 34:53 */           throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "2", "org/jetbrains/lang/manifest/completion/ManifestCompletionContributor$1", "addCompletions" }));
/* 35:   */         }
/* 36:53 */         for (String str : paramHeaderParserRepository.getAllHeaderNames()) {
/* 37:54 */           paramAnonymousCompletionResultSet.addElement(LookupElementBuilder.create(str).withInsertHandler(ManifestCompletionContributor.a));
/* 38:   */         }
/* 39:   */       }
/* 40:   */     });
/* 41:   */   }
/* 42:   */   
/* 43:61 */   private static final InsertHandler<LookupElement> a = new InsertHandler()
/* 44:   */   {
/* 45:   */     public void handleInsert(InsertionContext paramAnonymousInsertionContext, LookupElement paramAnonymousLookupElement)
/* 46:   */     {
/* 47:64 */       paramAnonymousInsertionContext.setAddCompletionChar(false);
/* 48:65 */       EditorModificationUtil.insertStringAtCaret(paramAnonymousInsertionContext.getEditor(), ": ");
/* 49:66 */       paramAnonymousInsertionContext.commitDocument();
/* 50:   */     }
/* 51:   */   };
/* 52:   */ }



/* Location:           E:\idea\

 * Qualified Name:     org.jetbrains.lang.manifest.completion.ManifestCompletionContributor

 * JD-Core Version:    0.7.0.1

 */